package com.qq.weixin.constant;

/**
 * 事件类别
 * @author li.jiang
 *
 */
public final class EventType {
    /**
     * 关注
     */
    public static final String SUBSCRIBE = "subscribe";
    /**
     * 取消关注
     */
    public static final String UNSUBSCRIBE = "unsubscribe";
    /**
     * 扫描二维码
     */
    public static final String SCAN = "SCAN";
    /**
     * 地理位置
     */
    public static final String LOCATION = "LOCATION";
    /**
     * 菜单点击
     */
    public static final String CLICK = "CLICK";
    /**
     * 菜单链接跳转
     */
    public static final String VIEW = "VIEW";
    private EventType() {
    }
    /**
     * 在XML中匹配指定事件类别的正则表达式
     * @author li.jiang
     *
     */
    static final class Regex {
        public static final String SUBSCRIBE = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[event\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Event\\>\\<\\!\\[CDATA\\[subscribe\\]\\]\\>\\<\\/Event\\>\\s*" // NOSONAR
                + "\\s*\\<EventKey\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/EventKey\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String UNSUBSCRIBE = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[event\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Event\\>\\<\\!\\[CDATA\\[unsubscribe\\]\\]\\>\\<\\/Event\\>\\s*" // NOSONAR
                + "\\s*\\<EventKey\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/EventKey\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String SCAN = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[event\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Event\\>\\<\\!\\[CDATA\\[SCAN\\]\\]\\>\\<\\/Event\\>\\s*" // NOSONAR
                + "\\s*\\<EventKey\\>\\<\\!\\[CDATA\\[\\d+\\]\\]\\>\\<\\/EventKey\\>\\s*" // NOSONAR
                + "\\s*\\<Ticket\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/Ticket\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String UNSUBSCRIBE_SCAN = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[event\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Event\\>\\<\\!\\[CDATA\\[subscribe\\]\\]\\>\\<\\/Event\\>\\s*" // NOSONAR
                + "\\s*\\<EventKey\\>\\<\\!\\[CDATA\\[qrscene_\\d+\\]\\]\\>\\<\\/EventKey\\>\\s*" // NOSONAR
                + "\\s*\\<Ticket\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/Ticket\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String LOCATION = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[event\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Event\\>\\<\\!\\[CDATA\\[LOCATION\\]\\]\\>\\<\\/Event\\>\\s*" // NOSONAR
                + "\\s*\\<Latitude\\>.+\\<\\/Latitude\\>\\s*" // NOSONAR
                + "\\s*\\<Longitude\\>.+\\<\\/Longitude\\>\\s*" // NOSONAR
                + "\\s*\\<Precision\\>.+\\<\\/Precision\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String CLICK = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[event\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Event\\>\\<\\!\\[CDATA\\[CLICK\\]\\]\\>\\<\\/Event\\>\\s*" // NOSONAR
                + "\\s*\\<EventKey\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/EventKey\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String VIEW = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[event\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Event\\>\\<\\!\\[CDATA\\[VIEW\\]\\]\\>\\<\\/Event\\>\\s*" // NOSONAR
                + "\\s*\\<EventKey\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/EventKey\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR
        private Regex() {
        }
    }
}
